Research on permanent magnet synchronous motor algorithm based on linear nonlinear switching self-disturbance rejection control

This paper presents a linear-nonlinear switching control strategy, called Switching Active Disturbance Rejection Control (SADRC), to enhance the disturbance rejection capability of the speed controller in a servo system. SADRC combines the advantages of Linear Active Disturbance Rejection Control (LADRC) and Nonlinear Active Disturbance Rejection Control (NLADRC), and introduces a parameter to switch between nonlinear and linear control, thereby improving the robustness of the servo system. Firstly, the mathematical model of the motor is analyzed as the starting point of the paper. Then, the basic principles of Active Disturbance Rejection Control (ADRC) are analyzed, and improvements are made to address its limitations, resulting in the design of SADRC. The parameters introduced in SADRC are analyzed to determine their appropriate ranges. Finally, the performance of SADRC is validated by comparing the rotational effects of Permanent Magnet Synchronous Motor (PMSM).

It is well known that the servo system takes the difference between the set value and the feedback value as input.The servo system is commonly used in fields such as industrial robotic arms, aerospace, and CNC machine tools, which require high motor performance and control accuracy 1, 2 .Taking industrial robotic arms as an example, the control performance of the servo system directly determines the production speed and product quality of the production line.Therefore, improving the robustness of the servo system is of great significance.The overall performance of the servo system is mainly determined by two parts.One is the hardware aspect, such as the operating speed and control frequency of the control chip, the accuracy of the encoder, the motor structure [3][4][5] , and the motor type 6 .The other aspect is the control algorithm, and different control algorithms also determine the performance of the entire system.Among them, the speed controller and current controller commonly use PI control.Due to its simplicity and good performance, PI control is widely used in the industrial control field.However, with the continuous improvement of industrial requirements, ordinary PI control is difficult to meet the requirements of high-performance servo systems.It is of great significance to improve the robustness of the servo system through optimized control algorithms.Many scholars have conducted in-depth research on control algorithms, such as proportional-integral (PI) control with feedforward compensation, disturbance-based control 7 , Sliding Mode Control (SMC) [8][9][10] , Model Predictive Direct Speed Control (MP-DSC) 11 and Active Disturbance Rejection Control (ADRC), etc.
ADRC was initially proposed by researcher Han 12 .It is a nonlinear structure created by combining modern control theory with the PID controller.Subsequently, through the efforts of scholars such as Gao Zhiqiang, the bandwidth method was used to solve the parameter tuning and linearization issues of ADRC, enabling its application in engineering practice 13,14 .However, Linear Active Disturbance Rejection Control (LADRC) has a constant gain, which leads to large initial state errors and delayed response speed.In comparison, Nonlinear Active Disturbance Rejection Control (NLADRC) has higher tracking accuracy, stronger disturbance rejection capability, and faster response.However, the stability and reliability analysis of NLADRC is extremely difficult, which greatly hinders the practical application of ADRC 15,16 .Therefore, how to further enhance the robustness of the ADRC controller remains a challenge.In this regard, some scholars have conducted further research based on the ADRC framework.For example, Li et al. used the ADRC algorithm with an Extended State Observer (ESO) to suppress disturbances in control systems 17 .Qi provided proof of stability for NLADRC 18,19 .Zhao demonstrated the convergence of nonlinear active disturbance rejection, providing theoretical support for its application 20 .On the other hand, combining the advantages of LADRC and NLADRC can greatly improve

Mathematical model of permanent magnet synchronous motor
The object of control in this study is the permanent magnet synchronous motor.Assuming that the windings are symmetrical and disregarding core saturation, eddy current loss, and hysteresis loss, the mathematical model of a PMSM can be derived based on motor control theory.The stator-side voltage equation is shown in the following Eq.(1).
where u d , u q is the stator voltage component of the d-q coordinate system, ψ d ψ q is the stator flux component, and ω is the rotational angular velocity.The flux equation is (2).
where L d , L q is the inductance component of the d and q axes, and ψ f is the permanent magnet flux linkage.
This can be obtained from the above formula: Electromagnetic torque equation for PMSM: Among them T e is electromagnetic torque; P n is the number of pole pairs, and other parameters are the same as above.Mechanical equations of motion for PMSM: where T l is the load torque; J is the moment of inertia.

ADRC control principle LADRC control principle
ADRC is mainly composed of three parts: the tracking differentiator, the extended state observer, and the state error feedback control rate.The core idea of self-disturbance rejection control is to proactively extract disturbance information from the input/output signal of the controlled object before it significantly affects the final output of the system.This information is then used to eliminate the disturbance as quickly as possible using the control signal, thereby minimizing its impact on the controlled quantity.
The control object in this paper is a first-order system, specifically a permanent magnet synchronous motor.This type of motor is primarily utilized in the field of industrial robotic arms.The following state-space equation can be obtained.This is shown in the following Eq.( 6).
The lower x 1 is the system variable, f (x 1 , x 2 ) is the total disturbance of the system, b is the estimate of the gain of the control system, and u is the system input variable.The permanent magnet synchronous motor adopts a double closed-loop vector control system.The current loop utilizes traditional PI control, while the speed loop utilizes the SADRC.The control system is an inertial system.It takes a certain amount of time for the speed to reach the desired speed from zero.At the initial moment, there is a significant difference between the desired speed and the velocity feedback, resulting in a large overshoot.To achieve this, the transition process is designed to gradually increase the velocity.The equation for this process is as follows: v 0 (t) represents the given speed and r is the speed factor.v 1 is the tracking value of v 0 (t) , v 2 is the derivative of v 1 and r is the speed factor.ESO is a vital part of ADRC for real-time estimation of system variables, real-time (1) www.nature.com/scientificreports/estimation and compensation of total disturbances, elimination of disturbances, and improved control.For firstorder systems, LESO can be designed as follows: where z 1 , z 2 are the state variables of the observer, z 1 are used to track v 1 , z 2 is the estimation of the total pertur- bation, β 1 ′ , β 2 ′ are the gain factors of z 1 , and z 2 , respectively, and e is the error between the estimated value and the output value.The output of LESO is as follows: In a first-order linear system, LSEF can design P control: where K 1 are the gain factors of the error.

NLADRC control principle
The first-order NLADRC transition process is improved on LADRC: h is the step size." fhan " is the fastest tracking function, as follows: The transition process of NLADRC and LADRC is similar, and f can be replaced with the " fhan " function.NLESO introduces the nonlinear function fal(e, α i , δ) , which makes the observer have the characteristics of "small error, large gain, large error, small gain", the specific expression is as follows: where the expression for the nonlinear function fal(e, α i , δ) is: where β 1 , β 2 is the gain factor, α 1 , α 2 , and δ are pending parameters.The nonlinear state error feedback rate is also introduced into the nonlinear fal(e, α i , δ) function as follows: Among them, k 1 is tunable parameters, and α 1 ′ and δ ′ are the two pending parameters of NLSEF.

SADRC design
LADRC and NLADRC have their own advantages.LADRC is characterized by easy parameter adjustment and easy implementation in engineering.It is particularly effective when the error is large, as it allows for a large control gain.NLADRC has the characteristics of "small error, large gain, large error, small gain".In other words, NLADRC has a stronger adjustment ability when the error is small.As a switch, SADRC switches to NLADRC when the error is small and LADRC when the error is large, effectively utilizing the benefits of both LADRC and NLADRC.The framework of SADRC is shown in Fig. 1, v f the speed is given, and the speed step increases uniformly in the TD part.SESO is a system expansion state observer used to detect system state variables in real time.SSEF is the state error feedback rate, the input error signal is processed, the output u 0 is different from the compensation value of the observer.Finally, it is input into the control system.In the TD section, there is no clear distinction between LADRC and NLADRC, and there is no need to create a separate toggle switch.In the experiment, the discrete form of the TD part is designed as follows. (8) where f and v 2 are intermediate variables, and v f is given velocity.

Design of SESO and SSEF
The core of SADRC lies in the design of the fal s (e, α i , δ 1 , δ 2 ) function in SESO, which not only needs to meet the good control effect of NLADRC in the case of "small error", but also requires LADRC to have a large gain when the error is large.Figure 2 is the function curve of fal(e, α i , δ).
It can be seen from the curve that the smaller the value of the α i , the stronger the nonlinearity of the fal(e, α i , δ) function.Additionally, there is a greater the gain in the case of small errors, but the increase in gain is slower for large errors.In addition, δ is the critical point of the linear interval of fal(e, α i , δ) , the smaller the δ, the smaller the linear interval of the fal(e, α i , δ) function, the stronger the nonlinearity.In NLADRC, generally through continuous debugging α i , δ two parameters make the control effect of the system moderate, but it is impossible to ensure that the system can maintain a high control effect when the error changes in a large range.Therefore, this paper designs a class of function curves that maintain high gain and fast response speed even if the error fluctuates in a wide range, and the fal s (e, α i , δ 1 , δ 2 ) function is designed as follows: Among them, in order to ensure the system performance, the K c generally takes a value of 1, which can be adjusted according to the needs of the system.fal s (e, α i , δ 1 , δ 2 ) function compared with the fal(e, α i , δ) function, the introduction of δ 2 , δ 2 changes the gain of the controller under large error conditions, that is, the advantages of LADRC in large error conditions are fused.An image of the fal s (e, α i , δ 1 , δ 2 ) function is shown below.It can be seen from the curve that when the error range is −δ 1 < e < δ 1 , SADRC presents nonlinear characteristics, when the error range is |e| ≥ δ 2 , SADRC has the properties of LADRC, fal s (e, α i , δ 1 , δ 2 ) function combines the advantages of LADRC and NLADRC.The effect of δ 2 on the system is shown in Fig. 3.
In this experiment, SADRC is applied to the servo-controlled speed loop, so the system output y is the speed feedback v f , then SESO can be designed:  where z 1 is the state variable given by the tracking speed, z 2 is the system interference value, β 1 , β 2 are the coef- ficients to be determined, and u is the system output, as follows: u 0 is the output of SSEF, this experiment uses first-order SADRC, so SSEF directly uses proportional control, and SSEF is designed as:

SESO
The extended state observer is the core of the disturbance rejection control, which observes and compensates for the system disturbance in real time.The parameters to be determined are: β 1 , β 2 can be adjusted according to the bandwidth method.In order to ensure system stability the range of α 1 , α 2 , δ 1 , δ 2 can be reduced to: 0 < α 1 < α 2 < 1 , 0 < δ 1 < δ 2 ≤ 1 , the specific parameter setting process is as follows.( 18) is obtained by performing the Laplace transform: The bandwidth method for parameter tuning reference, let fal s (e, α 1 , δ 1 , δ 2 ) = 1 (e)e , al s (e, α 2 , δ 1 , δ 2 ) = 2 (e)e , ( 21) can be written as: From ( 22), we get the following transfer function model: Parameter tuning of reference 16 , β 1 = 3w 0 , β 2 = 0.6w 2 0 , SESO has a good suppression effect on the system output, and the influence of u can be ignored for analysis.
The frequency domain characteristic analysis plot of the system can be obtained from the transfer function, and it can be seen from the Fig. 4, with the increase of w 0 , the dynamic performance of SADRC is better.But in actual operation, the increase in w 0 also makes the motor control effect more ideal, too large w 0 will cause motor shaking and motor noise.Therefore, in the process of parameter adjustment, the w 0 should be gradually increased from a small value, and the w 0 when the motor is shaken is its critical value.that the smaller the α i , the stronger the nonlinearity of SADRC, but too small α i will cause the motor to produce high-frequency oscillation, in this experiment, 0.25 and 0.5 were taken α 1 and α 2 , respectively δ 1 and δ 2 determine the size of the nonlinear interval of SADRC, According to the system requirements, δ 1 and δ 2 are 0.05 and 1 respectively.TD There are two adjustable parameters in this expression, step h and speed factor r.
Step h is set to 0.01s, when the motor from the prohibition to the rated speed, the curve of different speed coefficients r is shown in Fig. 5, where the black line is the speed given, the red line is the speed given through the transition process of the speed output  v 1 , and the blue line is the speed feedback.The abscissa represents time, 4ms/scale, and the ordinate represents speed (the following coordinate diagrams are based on this standard).
This can be seen from Fig. 5, when r is 5 and 10, the rise time is 344ms and 192ms (sampled every 4ms), respectively, and when r increases to 200, the v 1 almost coincides with the given speed.Therefore, with the increase of r, the motor can reach the rated speed faster, but too large r will make the transition process invalid.In this experiment, r = 200 and h = 0.01 were taken.

SSEF
Introduce fal s (e, α i , δ 1 , δ 2 ) into the SEF, named SSEF.The state error feedback control rate is shown in Eq. (20), directly using proportional control, the pending parameters are: k p , α 1 ′ , δ 1 ′ , δ 2 ′ , b 0 where α 1 ′ , δ 1 ′ , δ 2 ′ are similar to the three parameters in SESO, and only need to be fine-tuned.In general, δ 1 ′ should be within the interval [0.01, 0.1].Therefore, in this experiment α 1 ′ , δ 1 ′ and δ 2 ′ are taken as 0.5, 0.1, and 1, respectively.b 0 determines the robustness of the system, the larger the b 0 , the more stable the system, but the control effect is relatively poor.k p is similar to PD-controlled k 1 , and the b 0 and k p of this experiment are taken as 20 and 380, respectively.

Experimental platform
In order to evaluate the performance of SADRC, this paper conducts experiments on the following platform and compares the experimental data with that of LADRC and NLADRC.In this paper, the selected experimental motor is a 400W surface-mounted permanent magnet synchronous motor with a holding gate line.In both the step experiment and the steady-state experiment, the motor is in the under-load state with a load size of 1 kg, as shown in Fig. 6.Since position information is not required for the experiment, the speed-current double closedloop mode is used.The absolute encoder monitors and provides real-time feedback on the motor speed.The surface-mount permanent magnet synchronous motor is a hidden-pole motor with a i d = 0 control strategy that ensures a linear relationship between the Q-axis current and the output torque.Table 1 provides a comprehensive list of parameters for PMSM.
In this experiment, SADRC is applied to a servo-controlled speed loop, while the current loop is controlled by PI controller and the motor rotation is controlled by Field-Oriented Control (FOC).Closed-loop control is   achieved by acquiring current information through the use of a sampling resistor.Finally, the experiment uses a PWM carrier frequency of 5kHz, and the specific control block diagram is shown in Fig. 7.
The rated speed of the motor is 3000 rpm, and the high current module can provide a voltage of 310V.The MCU adopts the STM32F407 chip, which has a maximum frequency of 168MHz.This frequency is sufficient to meet the control frequency requirements of the LADRC, NLADRC, and SADRC.The air switch is responsible for circuit protection, while the upper computer is responsible for algorithm parameter adjustment, data collection, and data collation.

Step experiments
The essence of the industrial robotic arm's action lies in the rotation of the PMSM.The speed curve of the PMSM is analyzed at two given speeds: 1000 rpm and 3000 rpm.The black line represents the given speed curve, while the red line represents the speed feedback curve.This is shown in Figs. 8 and Fig. 9. Figure 10 shows the PMSM velocity decline phase curve.The horizontal axis of the following graph represents time, with a specific scale of 4 ms/1.
Therefore, the LADRC control has a positive impact on the speed rise and fall stages, but it experiences a delay during the initial start and results in significant overshoot.NLADRC deviates from the speed given curve in the rising and falling stages of the velocity feedback curve, and this deviation increases.This is due to the nonlinear function characteristics of NLADRC.As the error increases, the gain of NLADRC increases at a slower rate, which results in minimal overshoot in NLADRC speed feedback.SADRC has obvious advantages in terms of response time, overshoot, and adjustment time, and the specific data are shown in Table 2 (Supplementary Information).

Steady-state performance
The overall stability of the industrial robotic arm is determined by the steady-state performance of the motor.This paper compares the steady-state error of the speed curve of three control algorithms to reflect the steadystate performance, as shown in Fig. 11.NLADRC is nonlinear and prone to high-frequency oscillations when the speed reaches a steady state.Highfrequency oscillations can be attenuated by adjusting the corresponding parameters, but this may also lead to a deterioration in the control effect.Table 3 displays the average steady-state error for the three controllers.

Figure 4 .
Figure 4. Bode plot of the transfer function.

Figure 12 .
Figure 12.Load mutation experimental current plot based on LADRC.

Figure 13 .
Figure 13.Load mutation experimental current plot based on NLADRC.

Figure 14 .
Figure 14.Load mutation experimental current plot based on SADRC.

Table 4 .
Load mutation adjustment time.